using UnityEngine;

public class TitanfallController : MonoBehaviour
{
	public static TitanfallController instance;

	private bool gotMyTitan;

	private void Awake()
	{
		instance = this;
	}

	public void SpawnTitan(SpawnPointChief.SpawnPoint point)
	{
		if (!gotMyTitan || TitanSpawner.instance.currentTitan == null || TitanSpawner.instance.currentTitan.name != settings.SelectedTitanName)
		{
			PrivateCarManager.instance.CarInstantiate(settings.SelectedTitanName, true);
			gotMyTitan = true;
		}
		PrivateCarManager.instance.CallCar(point, false, true);
		TitanSpawner.instance.currentTitan.transform.position = point.position;
		TitanSpawner.instance.currentTitan.transform.rotation = point.rotation;
		PlayerBehavior.MyPlayer.isImmortal = true;
		Invoke("GetIn", 0.1f);
	}

	private void GetIn()
	{
		PlayerBehavior.MyPlayer.GetInCarWithConfirmation(PlayerBehavior.MyPlayer.viewId, TitanSpawner.instance.currentTitan.viewId);
		PlayerBehavior.MyPlayer.isImmortal = true;
	}
}
